package com.qp.basics.common.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.qp.basics.common.annotation.FiledColumnInfo;
import com.qp.basics.common.base.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 公司表
 */
@Entity
@Data
@Table(name = "hr_company")
public class Company extends BaseEntity implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    /**所属工会*/
    @JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "dept_id")
    @FiledColumnInfo(queryType = "=",formType = "TableSelect",fkTitleColName = "name")
    private Dept dept;
    /**公司名称*/
    @FiledColumnInfo(queryType = "like")
    private String title;

    /**机构类型*/
    @FiledColumnInfo(queryType = "in",formType = "Select",dictName="companyType")
    private String type;
    /**公司性质：对应字典：hr_cmpnature*/
    @FiledColumnInfo(queryType = "in")
    private String nature;

    /**企业规模*/
    @FiledColumnInfo(queryType = "=")
    private String insize;
    /**成立时间*/
    private String buildDate;
    /**注册资金*/
    private String buildAmount;

    /**所属行业*/
    @FiledColumnInfo(queryType = "in",formType = "Select",dictName="industry")
    private String industry;

    /**省份*/
    private String province;
    /**城市*/
    @FiledColumnInfo(queryType = "like")
    private String city;
    /**所属区*/
    private String district;
    /**地址*/
    private String address;
    /**公司介绍*/
    @FiledColumnInfo(queryType = "like",formType = "Textarea")
    private String introduction;
    /**公司logo*/
    private String logo;
    /**营业执照*/
    private String licensePhoto;
    /**公司特色*/
    private String features;

    /**状态*/
    @FiledColumnInfo(queryType = "like")
    private String status;
    /**修改时间戳*/
    private Long modifyTime;//与modifyrecord的modifyTime对应，找到修改记录


    @JsonIgnoreProperties(value = {"hibernateLazyInitializer"})
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "user_info_id")
    @ApiModelProperty(value = "会员")
    @JsonIgnore
    @FiledColumnInfo(queryType = "=",formType = "TableSelect",fkTitleColName = "title")
    @NotFound(action= NotFoundAction.IGNORE)
    private UserInfo userInfo;

    /**审核时间 */
    private Date checkTime;

    /**审核人 */
    private String checkerId;

    /**审核详情 */
    private String checkMsg;

    /**沟通标识*/
    private String chatFlag;// 企业信息沟通开关，T/F  F表示关闭沟通，这时求职人无法发起沟通

    /*微信账号*/
    private String wxMchId;
    private String wxMchKey;
    private String wxKeyPath;

    /*支付宝账号*/
    private String aliMchId;
    private String aliMchKey;
    private String aliKeyPath;

    /*北京银行账号*/
    private String bjBankMchId;
    private String bjBankMchKey;
    private String bjBankKeyPath;

    @ApiModelProperty("1为供应商 0企业 2企业用户 3母婴")
    @Column(name = "is_supplier")
    private Integer isSupplier;


    /**
     * 供应商需要的字段
     * @return
     */
//
//    @ApiModelProperty("工作开始时间")
//    private String workStartTime;
//
//    @ApiModelProperty("工作结束时间")
//    private String workEndTime;

    @ApiModelProperty("工作开始时间")
    private String workTime;



    @ApiModelProperty("联系人")
    private String contacts;

    @ApiModelProperty("电话")
    private String phone;

    @ApiModelProperty("手机")
    private String mobile;

    @ApiModelProperty("邮箱")
    private String email;

    @ApiModelProperty("经度")
    private String lng;

    @ApiModelProperty("纬度")
    private String lat;

    @ApiModelProperty("邮编")
    private String zipCode;




    public int hashCode(){
        if(id == null)return super.hashCode();
        return id.hashCode();
    }
}
